package com.ynet.middleground.contract.conf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.ynet.middleground.contract.policy.NewRenderDataCompute;

/**
 * @author liulx
 * @description poi-tl 配置
 * @date 2020-04-30 16:18
 */
@Configuration
public class TemplateConfig {

    @Autowired
    NewRenderDataCompute newRenderDataCompute;

    @Bean
    public Configure configure() {
        // SpringEL 表达式配置
        ConfigureBuilder configureBuilder = Configure.newBuilder();
        configureBuilder.setElMode(Configure.ELMode.SPEL_MODE);
        configureBuilder.setRenderDataComputeFactory(newRenderDataCompute);
        return configureBuilder.build();
        // 原始使用方式，保留
        // return Configure.newBuilder().build();
    }

}
